Lua: Calling functions of another script (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios



Message


hawkeye_de -> Lua: Calling functions of another script (1/4/2015 11:28:06 AM)

Is it not possible to use require in the Lua sandbox of CMNO ?

So, I have a script file in the Lua directory

function testFunction(unit)
return unit.name
end


and try to call in the console:

myModule = require "myModule"
myModule.testFunction(unit)


as error I get

ERROR: [string "chunk"]:2: attempt to call global 'require' (a nil value)

If require does not work, is there any other means to create reuse functions, which I could reuse ?

Thanks.




DeSade -> RE: Lua: Calling functions of another script (1/4/2015 8:11:14 PM)

try ScenEdit_RunScript (script):

http://commandlua.github.io/#ScenEdit_RunScript

script (library usually) should reside in Lua folder




Dimitris -> RE: Lua: Calling functions of another script (1/4/2015 8:45:03 PM)

One of the things coming in v1.07 is that you'll be able to bundle such scripts with the scen you are distributing and have it work "out of the box" without having to instruct the end player to do anything ("place this file here" etc.).




hawkeye_de -> RE: Lua: Calling functions of another script (1/5/2015 6:12:10 AM)

Hm...the Runscript is not the same as require

For instance, it does not allow you to bind external libraries. Also, my understanding is that RunScript executes a script but not a function.

Additionally:
ZeroBraneStudio IDE (http://studio.zerobrane.com/doc-remote-debugging) supports remote debugging...that is you should be able to debug embedded scripts. See for a usecase here: http://notebook.kulchenko.com/zerobrane/debugging-wireshark-lua-scripts-with-zerobrane-studio

But to do so, you need to bind a library...




Dimitris -> RE: Lua: Calling functions of another script (1/5/2015 7:35:23 AM)

Hawkeye, how's your SSN sim going? I recently tried accessing your blog on it but seems to have vanished.




hawkeye_de -> RE: Lua: Calling functions of another script (1/5/2015 9:50:48 AM)


quote:

ORIGINAL: Sunburn

Hawkeye, how's your SSN sim going? I recently tried accessing your blog on it but seems to have vanished.


I've disabled the blog....the feedback which I've got was quite limited, so I've thought it is not worth the effort.

Frankly, I've developed it not so much further in the last 2-3 months. To do this alone in your spare time is really tough. I think developing such a sim like you in a team, would make much more sense.

Also from a game design perspective, there is the issue (in contrast to Command) that submarine combat is really slow. So, atmosphere is important, which translates into the fact, that you need a sophisticated UI experience. A hell of work ;)

Anyways, here are some screenshots from the current build:

http://www.directupload.net/file/d/3858/z6wgduu3_jpg.htm
http://www.directupload.net/file/d/3858/lgmhnhua_jpg.htm
http://www.directupload.net/file/d/3858/w3ojyl3d_jpg.htm
http://www.directupload.net/file/d/3858/eopefd7y_jpg.htm




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
1.578125