rimuln / openwig

Automatically exported from code.google.com/p/openwig
0 stars 0 forks source link

How to set env.put(DEVICE_ID,"WhereYouGo") from WhereYouGo #197

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I downloaded WhereYouGo and the new OpenWIG and compiled it. No problem. When I 
run a cartridge, I get a RuntimeException, because env.get(DEVICE_ID) is null. 
Then I asked Menion and he said, that he patched the source of 
WherigoLib.register(LuaState state) from OpenWIG with the line 
"env.put(DEVICE_ID, "WhereYouGo");".

Now my question: is this the right way? Couldn't it be handled, if we make a 
new instance of the Engine? This way, we hadn't to patch the OpenWIG code each 
time.

Best regards
Dirk (Charlenni)

Original issue reported on code.google.com by dirk.we...@googlemail.com on 30 Oct 2012 at 1:39

GoogleCodeExporter commented 9 years ago
oh wow, you're trying to build WhereYouGo, cool!

Patching Engine is definitely not the way to go.
The env property is public in WherigoLib, and the runtime exception even tells 
you exactly what to do: at any point, ideally right at start of the app, before 
you even instantiate Engine, call from your code:
WherigoLib.env.put(WherigoLib.DEVICE_ID, "WhereYouGo");

In the newest version, there's even an API for that, interface UI defines a 
method getDeviceID(). but that might just be in my private repo at this point...
still, having WherigoLib.env public is a good idea because sometimes it can be 
useful to modify Env table from outside.

Original comment by matej...@gmail.com on 30 Oct 2012 at 1:53