|
Post by hermit on Dec 26, 2005 17:31:23 GMT -5
I'm sorry I'm having trouble for some odd reason finding syntax for a function. I read the doc. for Lua and I looked at other's scripts but I can find any functions. I'm just so used to organizign code in OOP that I have trouble collecting my thoughts any other way ; ;
Please if you could assist me : <
PS: Is is true you can use C in Lua and if that's the case can I use C in Lunar? Where would I find problems writing scripts in C?
|
|
|
Post by X-Drop on Dec 26, 2005 17:35:39 GMT -5
|
|
|
Post by hermit on Dec 26, 2005 18:06:08 GMT -5
To be honest X-Drop I just saw your leviathan script and that's where I found my answer. But I did see Porgramming in Lua site which provided me with a rather obscure answer >.<
Thank you though : )
Answer:
function nameOfFuncation()
end
|
|
|
Post by TinyTerror on Dec 26, 2005 18:10:51 GMT -5
I do not allow c/c++ libraries to be loaded in lunar due to massive security issues. I'm a C++ programmer at heart, so this was a tough choice. I have no plans to change this.
|
|
|
Post by feldoh on Jan 12, 2006 22:47:05 GMT -5
What security issues could it have? People making malicious scripts?
|
|
|
Post by TinyTerror on Jan 13, 2006 15:02:20 GMT -5
Think about it. Giving people the ability to run precompiled library code under lunar would be like letting them run random exe files on your computer but far worse. I don't even want to think about the kind of damage some ass hole could do to your computer if I enabled this feature.
|
|
sdphantom
Full Member
Savior and Destroyer
Posts: 230
|
Post by sdphantom on Jan 13, 2006 21:22:15 GMT -5
I think he means something different. Tiny did disable loading in library functions for that reason.
Lua is nothing more than a script interpreter written in C. It's actually released for developers to embed this interpreter into other programs so the mass public can write scripts that do various things with the host program. The Lua docs doesn't really seperate information to be reguarded by the developer and the scripter seperately, making this kind of confusion.
Basically saying, no, you can't write C code within a Lua script. The docs were simply showing the developer how to write additional functions to link Lua with whatever host program it'll be running in. Simply put, telling Tiny how to make Lunar and the Lua interpreter work together. Nothing more.
|
|
|
Post by X-Drop on Jan 13, 2006 21:34:51 GMT -5
That makes alot of sence.... well said.
|
|
|
Post by TinyTerror on Jan 13, 2006 23:50:57 GMT -5
Yeah, the docs for lua can be highly academic sometimes. It took me a long time to figure out exactly what was going on.
|
|
sdphantom
Full Member
Savior and Destroyer
Posts: 230
|
Post by sdphantom on Jan 14, 2006 5:00:19 GMT -5
I was interested at first when I heard that C can be used in Lua, so I dove deeper into the Lua docs and found the truth to what they really ment.
The only thing I ever use the Lua docs for anymore is section 5.1-5.8 of the PDF version (pages 39-55) for the standard library function refrences, lol. ;D
|
|
|
Post by TinyTerror on Jan 14, 2006 11:45:53 GMT -5
Yeah, theoretically you can load compiled C code in the form of a dll or something into a lua state. Its disabled. If you are interested, I can provide you with a skeleton lua wrapper function to play with. It will allow you to make a function for lunar in C++. Naturally I will check it out for gremlins before putting it into lunar.
|
|
sdphantom
Full Member
Savior and Destroyer
Posts: 230
|
Post by sdphantom on Jan 14, 2006 19:54:34 GMT -5
I guess I'm not getting the point across yet. When code is compiled, I consider the result code, binary, no matter what language was used to make it.
Source code = C Compiled code = binary ^.^;
Example.. You can't copy and paste
int main(int argc,char* argv[]){ printf("bleh!"); //sample C code }
into a Lua script (ex. "printbleh.lua") and expect it to work.
Loading a DLL binary is an entirely different concept. Also, writing additional libraries to be compiled into Lunar isn't really something that every script writer is going to have in mind, that's also a different from what was/is assumed by many people reading Lua's crappy docs.
|
|