into a widget, it creates a text file, thing.txt in the root spring directory with the text "some text"
If I put the same code into a gadget, I get this in the infolog:
Code:
[f=0000000] Loading LuaRules [f=0000000] Failed to load: build_block.lua ([string "LuaRules/Gadgets/build_block.lua"]:32: attempt to index global 'io' (a nil value))
Joined: 22 Feb 2006, 01:02 Location: cheap kitchen
gadgets are synced, but file io is not. eg on one computer writing to thing.txt might fail due to no disk space or whatever but maybe for another player it works -> desync. I half expected it to work in unsynced gadget but does not work either.
Quote:
-fixt' we can read in files why no output?
read in as with VFS.Include? I think that is something else.
gadgets are synced, but file io is not. eg on one computer writing to thing.txt might fail due to no disk space or whatever but maybe for another player it works -> desync. I half expected it to work in unsynced gadget but does not work either
Same, I figured I should be able to do it in gadget unsynced...
Oh, yeah, that actually makes sense. Now I just have to figure out how to write/read the data using VFS. It's questionable whether it's worth it--the data is a matrix calculated from a map (based on height & type), which takes only a few seconds to calculate on a single core 1.7ghz processor. It just seems silly to calculate it every time the map loads, because it's going to be the same every time.
Joined: 22 Feb 2006, 01:02 Location: cheap kitchen
Lua VFS is only for reading from archives. http://springrts.com/wiki/Lua_VFS You can not use it to write a bla.txt and later read it.
Quote:
the data is a matrix calculated from a map (based on height & type)
If it is for viewtopic.php?f=13&t=27550 you could just calculate the matrix once on your computer and then include the result in the map.sdz? Also saves you from having to make some anti-cheat system.
you could just calculate the matrix once on your computer and then include the result in the map.sdz?
Oops, yeah that's what I meant by "write/read the data using VFS"--just the reading part. But I need to somehow format the data in a way that's readable using VFS (I get the impression text file with numbers in it won't work).
The good news is it works--AIs play on the map without cheating (i.e. building on the sand).
Users browsing this forum: No registered users and 1 guest
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum