mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 19:25:20 -04:00
made loadfile standard lua conformant in that it skips the first line in a file if it starts with a #
This commit is contained in:
parent
982624503d
commit
a88f8443b1
@ -16,6 +16,14 @@ function loadfile(filename, mode, env)
|
|||||||
if not source then
|
if not source then
|
||||||
return nil, reason
|
return nil, reason
|
||||||
end
|
end
|
||||||
|
if string.sub(source, 1, 1) == "#" then
|
||||||
|
local endline = string.find(source, "\n", 2, true)
|
||||||
|
if endline then
|
||||||
|
source = string.sub(source, endline + 1)
|
||||||
|
else
|
||||||
|
source = ""
|
||||||
|
end
|
||||||
|
end
|
||||||
return load(source, "=" .. filename, mode, env)
|
return load(source, "=" .. filename, mode, env)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user