From a88f8443b1e7cfafb24e0427d95ffb02b6a93338 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Tue, 28 Jan 2014 00:08:07 +0100 Subject: [PATCH] made loadfile standard lua conformant in that it skips the first line in a file if it starts with a # --- assets/opencomputers/lua/rom/boot/00_base.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/assets/opencomputers/lua/rom/boot/00_base.lua b/assets/opencomputers/lua/rom/boot/00_base.lua index 6e0b16973..835fccd1c 100644 --- a/assets/opencomputers/lua/rom/boot/00_base.lua +++ b/assets/opencomputers/lua/rom/boot/00_base.lua @@ -16,6 +16,14 @@ function loadfile(filename, mode, env) if not source then return nil, reason 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) end