Add casts to lua_Number to allow working with floating point runtimes
This commit is contained in:
parent
22d46ce57c
commit
2d9a997e04
@ -83,6 +83,9 @@ LUALIB_API void luaL_where (lua_State *L, int level) {
|
||||
}
|
||||
|
||||
|
||||
#ifdef _MANAGED
|
||||
#pragma managed(push, off)
|
||||
#endif
|
||||
LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) {
|
||||
va_list argp;
|
||||
va_start(argp, fmt);
|
||||
@ -92,6 +95,9 @@ LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) {
|
||||
lua_concat(L, 2);
|
||||
return lua_error(L);
|
||||
}
|
||||
#ifdef _MANAGED
|
||||
#pragma managed(pop)
|
||||
#endif
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
@ -567,14 +573,16 @@ LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) {
|
||||
c = getc(lf.f);
|
||||
if (c == '#') { /* Unix exec. file? */
|
||||
lf.extraline = 1;
|
||||
while ((c = getc(lf.f)) != EOF && c != '\n') ; /* skip first line */
|
||||
while ((c = getc(lf.f)) != EOF && c != '\n')
|
||||
; /* skip first line */
|
||||
if (c == '\n') c = getc(lf.f);
|
||||
}
|
||||
if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */
|
||||
lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */
|
||||
if (lf.f == NULL) return errfile(L, "reopen", fnameindex);
|
||||
/* skip eventual `#!...' */
|
||||
while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) {};
|
||||
while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0])
|
||||
;
|
||||
lf.extraline = 0;
|
||||
}
|
||||
ungetc(c, lf.f);
|
||||
|
@ -27,15 +27,15 @@ int os_getversion(lua_State* L)
|
||||
lua_newtable(L);
|
||||
|
||||
lua_pushstring(L, "majorversion");
|
||||
lua_pushnumber(L, info.majorversion);
|
||||
lua_pushnumber(L, (lua_Number)info.majorversion);
|
||||
lua_settable(L, -3);
|
||||
|
||||
lua_pushstring(L, "minorversion");
|
||||
lua_pushnumber(L, info.minorversion);
|
||||
lua_pushnumber(L, (lua_Number)info.minorversion);
|
||||
lua_settable(L, -3);
|
||||
|
||||
lua_pushstring(L, "revision");
|
||||
lua_pushnumber(L, info.revision);
|
||||
lua_pushnumber(L, (lua_Number)info.revision);
|
||||
lua_settable(L, -3);
|
||||
|
||||
lua_pushstring(L, "description");
|
||||
|
@ -39,7 +39,7 @@ int os_stat(lua_State* L)
|
||||
lua_settable(L, -3);
|
||||
|
||||
lua_pushstring(L, "size");
|
||||
lua_pushnumber(L, s.st_size);
|
||||
lua_pushnumber(L, (lua_Number)s.st_size);
|
||||
lua_settable(L, -3);
|
||||
|
||||
return 1;
|
||||
|
@ -11,7 +11,7 @@
|
||||
int string_hash(lua_State* L)
|
||||
{
|
||||
const char* str = luaL_checkstring(L, 1);
|
||||
lua_pushnumber(L, do_hash(str, 0));
|
||||
lua_pushnumber(L, (lua_Number)do_hash(str, 0));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user