-
-
Notifications
You must be signed in to change notification settings - Fork 308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Lua chunknames standardized across platforms and formats #6920
Conversation
This makes things consistent across script components and Lua modules and between bytecode and source code
@@ -330,7 +330,7 @@ local function stack(start) | |||
if not source then break end | |||
|
|||
local src = source.source | |||
if src:find("[@=]") == 1 then | |||
if src:find("@") == 1 then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can now safely revert this patch since we no longer provide filenames starting with = (see script_module.cpp)
@@ -633,8 +633,8 @@ local function debug_hook(event, line) | |||
-- Unfortunately, there is no reliable/quick way to figure out | |||
-- what is the filename and what is the source code. | |||
-- If the name doesn't start with `@`, assume it's a file name if it's all on one line. | |||
if find(file, "^[@=]") or not find(file, "[\r\n]") then | |||
file = gsub(gsub(file, "^[@=]", ""), "\\", "/") | |||
if find(file, "^@") or not find(file, "[\r\n]") then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
int LuaLoad(lua_State *L, dmLuaDDF::LuaSource *source) | ||
{ | ||
const char *buf; | ||
uint32_t size; | ||
GetLuaSource(source, &buf, &size); | ||
char tmp[DMPATH_MAX_PATH]; | ||
return luaL_loadbuffer(L, buf, size, PrefixFilename(FindSuitableChunkname(source->m_Filename), '=', tmp, sizeof(tmp))); | ||
return luaL_loadbuffer(L, buf, size, source->m_Filename); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always use the filename provided by LuaBuilder
@@ -142,7 +102,7 @@ namespace dmScript | |||
return 1; | |||
} | |||
|
|||
if (!LuaLoadModule(L, module->m_Script, module->m_ScriptSize, name)) | |||
if (!LuaLoadModule(L, module->m_Script, module->m_ScriptSize, module->m_Filename)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do the same for Lua modules. Always use what LuaBuilder.java has provided as filename.
com.dynamo.cr/com.dynamo.cr.bob/src/com/dynamo/bob/pipeline/LuaBuilder.java
Outdated
Show resolved
Hide resolved
dmStrlCpy(&buf[1], input, size-1); | ||
return buf; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
--skip-ci
@matgis discovered issues with hotreload of Lua modules (scripts work fine). We need to look into this first. |
…ndidates Show options when there are multiple candidates for a partial console path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great! The editor parts have been reviewed by Vlad already.
Engine
The chunk/filename set at runtime is not consistent between Lua modules and script components. The same is true for bytecode when compared to source code.
Examples:
The file
game/foo.lua
was either given=game.foo
or@game/foo.lua
depending on wether it was compiled to bytecode or not. The same kind of differences could be observed for script components.With this change all Lua scripts and modules will use the same naming convention which is
@path/to/file.lua
or@path/to/file.script
. The @ is used so that Lua will show the last 60 of long filenames.Editor User-facing changes
.lua
modules.Editor Technical changes
on-click!
callback for acode.view
region is now called with an additionalMouseEvent
argument.Fixes #6485