This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Timtower's profile picture

[Lua]IF statement in loadstring?

Started by Timtower, 08 February 2013 - 04:50 AM
Timtower #1
Posted 08 February 2013 - 05:50 AM
Title:[Lua]IF statement in loadstring?

Hi,
I am trying to create an php like internet for computercraft but I am stuck on something:
my entire program is dependent on the loadstring thingie.
but my problem is that IF statements won't work on the normal way,
any ideas?
here is the link to my code ;)/>
everything is in Dutch, but I hope that that won't be a problem
http://pastebin.com/F0Qs3cEt
Lyqyd #2
Posted 08 February 2013 - 07:20 AM
They do work the normal way. You're missing an end on that if string near the beginning of your program though, so that string won't load. Also, you may wish to use block quotes. Anything in them will not require escaping. [[So you can "write" like this 'and' not need

to escape your text()]]
LBPHacker #3
Posted 08 February 2013 - 07:29 AM
Good idea so far. But the difference between this and PHP is that this sends the "program", the entire script to the client, and that's pretty risky. In PHP, you cannot just read the PHP code, you get the "preprocessed" HTML page instead. (Y'know: Personal Homepage: Hypertext Preprocessor…)
Timtower #4
Posted 08 February 2013 - 07:53 AM
They do work the normal way. You're missing an end on that if string near the beginning of your program though, so that string won't load. Also, you may wish to use block quotes. Anything in them will not require escaping. [[So you can "write" like this 'and' not need to escape your text()]]
Thank you, the block quotes work like a charm
Good idea so far. But the difference between this and PHP is that this sends the "program", the entire script to the client, and that's pretty risky. In PHP, you cannot just read the PHP code, you get the "preprocessed" HTML page instead. (Y'know: Personal Homepage: Hypertext Preprocessor…)
And I dont care that it is risky ;)/> I don't want to change the code on 10 computers to show the page on the right way ;)/>