mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Changed embedded Lua scripts to be included in the love source via C++11's raw string literals instead of a generated header file. Removed auto.lua.
As a result, love can be compiled immediately after editing an embedded Lua script. Visual Studio 2013 or newer is required for C++11 raw string literals in Windows.
This commit is contained in:
@@ -26,7 +26,6 @@
|
||||
#include "font/Rasterizer.h"
|
||||
#include "filesystem/wrap_Filesystem.h"
|
||||
|
||||
#include "scripts/graphics.lua.h"
|
||||
#include <cassert>
|
||||
|
||||
namespace love
|
||||
@@ -1504,6 +1503,11 @@ static const lua_CFunction types[] =
|
||||
0
|
||||
};
|
||||
|
||||
// Scripts.
|
||||
static const char graphics_lua[] =
|
||||
#include "scripts/graphics.lua"
|
||||
;
|
||||
|
||||
extern "C" int luaopen_love_graphics(lua_State *L)
|
||||
{
|
||||
if (instance == 0)
|
||||
@@ -1522,7 +1526,7 @@ extern "C" int luaopen_love_graphics(lua_State *L)
|
||||
|
||||
int n = luax_register_module(L, w);
|
||||
|
||||
if (luaL_loadbuffer(L, (const char *)graphics_lua, sizeof(graphics_lua), "graphics.lua") == 0)
|
||||
if (luaL_loadbuffer(L, graphics_lua, sizeof(graphics_lua), "graphics.lua") == 0)
|
||||
lua_call(L, 0, 0);
|
||||
|
||||
return n;
|
||||
|
||||
@@ -44,9 +44,6 @@
|
||||
# include "libraries/enet/lua-enet.h"
|
||||
#endif
|
||||
|
||||
// Scripts
|
||||
#include "scripts/boot.lua.h"
|
||||
|
||||
// All modules define a c-accessible luaopen
|
||||
// so let's make use of those, instead
|
||||
// of addressing implementations directly.
|
||||
@@ -286,9 +283,14 @@ int w__openConsole(lua_State *L)
|
||||
|
||||
#endif // LOVE_LEGENDARY_CONSOLE_IO_HACK
|
||||
|
||||
// Scripts.
|
||||
static const char boot_lua[] =
|
||||
#include "scripts/boot.lua"
|
||||
;
|
||||
|
||||
int luaopen_love_boot(lua_State *L)
|
||||
{
|
||||
if (luaL_loadbuffer(L, (const char *)love::boot_lua, sizeof(love::boot_lua), "boot.lua") == 0)
|
||||
if (luaL_loadbuffer(L, boot_lua, sizeof(boot_lua), "boot.lua") == 0)
|
||||
lua_call(L, 0, 1);
|
||||
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user