i'm implementing inapp billing in android app. works well, however, i'm trying decouple broadcast receiver activity manifest. suggestion in android's trivialdrive sample: // important: dynamically register broadcast messages updated purchases. // register receiver here instead of <receiver> in manifest // because call getpurchases() @ startup, therefore can ignore // broadcasts sent while app isn't running. // note: registering listener in activity bad idea, done here // because sample. regardless, receiver must registered after // iabhelper setup, before first call getpurchases(). currently there's class extends broadcastreceiver : public class iabbroadcastreceiver extends broadcastreceiver { /** * intent action receiver should filter for. */ public static final string action = "com.android.vending.billing.purchases_updated"; private final iabbroadcastlistener mlistener; public iabbroadcastreceiver(iabbroadcastlistener listener) { m...
i tried: print(math.random(999999999999)) , has printed 1 . also math.random() includes 999999999999 printing same thing. examples: print(math.random(1.999999999999)) » 1 print(math.random(1999999999999)) » 1 for k,v in next,{math.random(999999999999), math.random(1999999999999), math.random(2.999999999999)} print(v) end » 1 local n = math.random(999999999999) print(n==1) » true then think understood (if know lua of course). can explain me? @edits: the lua version i'm using 5.2. i tried print(math.random(-999999999999)) , printed 111711452 . looks worked positive number. this problem surely because math.random treats input arguments passed in lua 5.1 and/or 5.2. [mathlib.c] 1 : as may know in c , standard int can represent values -2,147,483,648 2,147,483,647 . adding +1 2,147,483,647 , in use-case, overflow , wrap around value giving -2,147,483,648 . end result negative since you're multiplying positive negative number. ther...
Comments
Post a Comment