Originally Posted by
ottizy
In llex.c lines 420 to 425.
Change(...)
However changing this will support of variables such as f$oo, bar$ etc.
oux, didn't think about that.... sht
well, thx a lot for the info, didn't know I had to recompile the lua library for that :O
Oks, so now with the information I have I can do the following:
1) go through the process of recompiling the library to add the $ support. Add support in a .lua for the $variables so they update the result of their function ( $hp--> getPlayerHP() ) with http://stackoverflow.com/questions/16614456/
Good things: performance will be pretty nice.
2) I was taking a break of this, watching a serie, and suddenly something flied over my mind... It's about the regex and so on:
let's see if I explain it right :S I'll divide the process in 3 parts as it would look the flow of data:
Script in .xml
PHP Code:
if $mp > 10 then ...
Delphi
PHP Code:
for each pos('$', ScriptInBuffer)[i] > 0 do
start:= pos('$', ScriptInBuffer)[i];
end:= pos(' ', ScriptInBuffer, [from $])[i];
str:= copy(start,end);
case str of
mp:
StringReplace(ScriptInBuffer, '$mp', 'lua.getMP_Delphi()')
hp:
etc...
Lua
PHP Code:
lua_tostring(ScriptInBuffer)
or lua_loadfile(ScriptInBuffer)
or w/e so it gets the info
-----------------------------------------------------------------------------
lol, after writing all of this I just notticed that I could have done it easier.... just
PHP Code:
StringReplace(ScriptInBuffer, '$mp', 'lua.getMP_Delphi()');
StringReplace(ScriptInBuffer, '$hp', 'lua.getHP_Delphi()');
StringReplace(ScriptInBuffer, '$cap', 'lua.getCapacity_Delphi()');
etc...
what do you guys think? sorry for annoying you with this noobie stuff :S